

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Model Validation Example [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Add-In Model,Add-In Model Model Validation Example,Model Validation Broadcasts,Model Validation Broadcasts Model Validation Example">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Model Validation Example</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="ea_onrunparameterrule.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="ea_onretrievemodeltemplate.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">The following example code is written in C# and provides a skeleton model validation implementation that you might like to use as a starting point in writing your own model validation rules.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Main.cs</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"><span class="f_Code">using System;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"><span class="f_Code">namespace myAddin</span></p>
<p class="p_Code"><span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public class Main</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public Rules theRules;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public Main()</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules = new Rules();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public string EA_Connect(EA.Repository Repository)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_Disconnect()</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">GC.Collect();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">GC.WaitForPendingFinalizers();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private bool IsProjectOpen(EA.Repository Repository)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">try</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Collection c = Repository.Models;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return true;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">catch</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return false;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public object EA_GetMenuItems(EA.Repository Repository, string MenuLocation, string MenuName)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (MenuName)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case &quot;&quot;:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;-&amp;myAddin&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case &quot;-&amp;myAddin&quot;:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">string[] ar = { &quot;&amp;Test&quot; };</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return ar;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_GetMenuState(EA.Repository Repository, string MenuLocation, string MenuName, string ItemName, ref bool IsEnabled, ref bool IsChecked)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// if no open project, disable all menu options</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (IsProjectOpen(Repository))</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">IsEnabled = true;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">else</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">IsEnabled = false;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_MenuClick(EA.Repository Repository, string MenuLocation, string MenuName, string ItemName)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (ItemName)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case &quot;&amp;Test&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">DoTest(Repository);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">break;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnInitializeUserRules(EA.Repository Repository)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (Repository != null)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules.ConfigureCategories(Repository);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules.ConfigureRules(Repository);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnRunElementRule(EA.Repository Repository, string RuleID, EA.Element element)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules.RunElementRule(Repository, RuleID, element);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnRunDiagramRule(EA.Repository Repository, string RuleID, long lDiagramID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules.RunDiagramRule(Repository, RuleID, lDiagramID);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnRunConnectorRule(EA.Repository Repository, string RuleID, long lConnectorID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">theRules.RunConnectorRule(Repository, RuleID, lConnectorID);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnRunAttributeRule(EA.Repository Repository, string RuleID, string AttGUID, long lObjectID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnDeleteTechnology(EA.Repository Repository, EA.EventProperties Info)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void EA_OnImportTechnology(EA.Repository Repository, EA.EventProperties Info)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private void DoTest(EA.Repository Rep)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: insert test code here</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">}</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Rules.cs</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"><span class="f_Code">using System;</span></p>
<p class="p_Code"><span class="f_Code">using System.Collections;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"><span class="f_Code">namespace myAddin</span></p>
<p class="p_Code"><span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public class Rules</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private string m_sCategoryID;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private System.Collections.ArrayList m_RuleIDs;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private System.Collections.ArrayList m_RuleIDEx;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private const string cRule01 = &quot;Rule01&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private const string cRule02 = &quot;Rule02&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private const string cRule03 = &quot;Rule03&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: expand this list as much as necessary</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public Rules()</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">m_RuleIDs = new System.Collections.ArrayList();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">m_RuleIDEx = new System.Collections.ArrayList();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private string LookupMap(string sKey)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return DoLookupMap(sKey, m_RuleIDs, m_RuleIDEx);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private string LookupMapEx(string sRule)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return DoLookupMap(sRule, m_RuleIDEx, m_RuleIDs);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private string DoLookupMap(string sKey, ArrayList arrValues, ArrayList arrKeys)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (arrKeys.Contains(sKey))</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return arrValues[arrKeys.IndexOf(sKey)].ToString();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">else</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private void AddToMap(string sRuleID, string sKey)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">m_RuleIDs.Add(sRuleID);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">m_RuleIDEx.Add(sKey);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private string GetRuleStr(string sRuleID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (sRuleID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule01:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;Error Message 01&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule02:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;Error Message 02&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule03:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;Error Message 03&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: add extra cases as much as necessary</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return &quot;&quot;;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void ConfigureCategories(EA.Repository Repository)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Project Project = Repository.GetProjectInterface();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">m_sCategoryID = Project.DefineRuleCategory(&quot;Enterprise Collaboration Architecture (ECA) Rules&quot;);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void ConfigureRules(EA.Repository Repository)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Project Project = Repository.GetProjectInterface();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">AddToMap(Project.DefineRule(m_sCategoryID, EA.EnumMVErrorType.mvError, GetRuleStr(cRule01)), cRule01);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">AddToMap(Project.DefineRule(m_sCategoryID, EA.EnumMVErrorType.mvError, GetRuleStr(cRule02)), cRule02);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">AddToMap(Project.DefineRule(m_sCategoryID, EA.EnumMVErrorType.mvError, GetRuleStr(cRule03)), cRule03);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: expand this list</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void RunConnectorRule(EA.Repository Repository, string sRuleID, long lConnectorID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Connector Connector = Repository.GetConnectorByID((int)lConnectorID);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (Connector != null)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (LookupMapEx(sRuleID))</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule02:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: perform rule 2 check</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">break;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: add more cases</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void RunDiagramRule(EA.Repository Repository, string sRuleID, long lDiagramID)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Diagram Diagram = Repository.GetDiagramByID((int)lDiagramID);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (Diagram != null)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (LookupMapEx(sRuleID))</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule03:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: perform rule 3 check</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">break;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: add more cases</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">public void RunElementRule(EA.Repository Repository, string sRuleID, EA.Element Element)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (Element != null)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">switch (LookupMapEx(sRuleID))</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">case cRule01:</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">DoRule01(Repository, Element);</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">break;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: add more cases</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">private void DoRule01(EA.Repository Repository, EA.Element Element)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">{</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">if (Element.Stereotype != &quot;myStereotype&quot;)</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">return;</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// TODO: validation logic here</span></p>
<p class="p_Code"><span class="f_Code">&nbsp;</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">// report validation errors</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">EA.Project Project = Repository.GetProjectInterface();</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">Project.PublishResult(LookupMap(cRule01), EA.EnumMVErrorType.mvError, GetRuleStr(cRule01));</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Code">}</span></p>
<p class="p_Code"><span class="f_Code">}</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
